//
//  Emoticon.swift
//  微博分支表情键盘
//
//  Created by JJ on 15/9/12.
//  Copyright © 2015年 JJ. All rights reserved.
//

import UIKit

class Emoticon: NSObject {
    
    var times:Int=0

    var chs:String?
    
    var png:String?
    
    var imagePath:String{
        
        return (png != nil) ? NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png! : ""
    }
    
    var code:String?{
        didSet{
            let scaner=NSScanner(string: code!)
            var value : UInt32 = 0
            scaner.scanHexInt(&value)
            emoji=String(Character(UnicodeScalar(value)))
        }
    }
    
    var emoji:String?
    
    var isRemove=false
    
    var isEmpty=false
    
    init(isEmpty:Bool){
        super.init()
        self.isEmpty=isEmpty
        
    }
    init(isRemove:Bool){
        super.init()
        
        self.isRemove = isRemove
    }
    
    init(dic:[String:String]){
        super.init()
        
        setValuesForKeysWithDictionary(dic)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description:String{
        let keys=["chs","png","code"]
    
        return dictionaryWithValuesForKeys(keys).description
    }
    
}
